package com.struts;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class ConfigListener implements ServletContextListener {

	public void contextDestroyed(ServletContextEvent arg0) {
	}

	public void contextInitialized(ServletContextEvent arg0) {
		System.out.println("ServletContextListener load ywhmvc config start");
		ServletContext context=arg0.getServletContext();
		String relativePath=context.getInitParameter("actionConfig");
		String realPath = context.getRealPath("\\");
		String url=realPath+relativePath;
		
		Map<String,ActionBean> map=XmlParser.parser(url);
		context.setAttribute("actionConfig", map);
		System.out.println("ServletContextListener load ywhmvc config end");
	}

}
